﻿//additional properties for jQuery object
$(document).ready(function () {
    //align element in the middle of the screen
    $.fn.alignCenter = function () {
        //get margin left
        var marginLeft = Math.max(40, parseInt($(window).width() / 2 - $(this).width() / 2)) + 'px';
        //get margin top
        var marginTop = Math.max(40, parseInt($(window).height() / 2 - $(this).height() / 2)) + 'px';
        //return updated element
        return $(this).css({ 'margin-left': marginLeft, 'margin-top': marginTop });
    };

});
